<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE>
<html>
<head>
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/layout.css" />
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Css/module_public.css" />
  <script type="text/javascript" src="__PUBLIC__/Js/jquery.js"></script>
  <script type="text/javascript" src="__PUBLIC__/Js/message.js"></script>
</head>
<body>
  <div class="module_public">
     <div class="module_public_content">
        <h1> >> 接收短信息页面 | <font color=green><a href="__URL__/alone_message">【单独发送新信息】</a></font><font color=green><a href="__URL__/batch_message">【批量发送新信息】</a></font><font color=green><a href="__ACTION__">【刷新】</a></font></h1>
     </div>
  <script type="text/javascript">
  $(function(){
   //查看短信息后将数据库的是否查看更新
   $(".look_message").click(function(){
	  var content = $(this).attr("name");
	  var m_id = $(this).attr("title");
	  
	  $.get("__URL__/doLook",{
		m_id : m_id  
	  },function(data){
		
	  });	  
	  alert(content);
	  location.reload();
   });
   
   
   //回复信息
   $(".reply_message").click(function(e){
	  //获取回复所需信息
	  var info = $(this).attr("title");
	  var reply_info = new Array();
	  reply_info = info.split("|"); 
	   
	  //获取点击元素的坐标
	  var position = $(this).offset();
	  var x = position.left;
	  var y = position.top; 

      //动态创建回复框
	  var reply_box = $("<div style='width:400px;height:205px;border:1px solid #cccccc;background:#F0F0F0;position:absolute;top:"+y+"px;left:"+(x-350)+"px;display:none;'><h1 style='font-size:16px;margin-left:5px;padding:5px;'>短信息回复 >><span style='float:right;margin-right:10px;cursor:pointer;' id='close_box'>[关闭]</span></h1><div style='width:380px;height:140px;background:#ffffff;margin:0px auto;'><textarea style='width:380px;height:140px;border:none;' name='reply_content'></textarea></div><input type='button' value='回复信息' class='_button' id='btn' style='margin-left:10px;margin-top:5px;'/></div>");
	  $("body").append(reply_box);
	  $(reply_box).slideDown(800);
	  
	  //关闭按钮处理
	  $("#close_box").click(function(){
		 reply_box.remove();  
	  });
	  
	  //点击提交AJAX传递参数到程序处理页面
	  $("#btn").click(function(){
		 var content = $("textarea[name='reply_content']").val();
		 $.get("__URL__/reply_message",{
			m_content  : content,
			m_sendname : reply_info[0],
			m_sendUid  : reply_info[1],
			m_rename   : reply_info[2],
			m_reUid    : reply_info[3],
			m_id       : reply_info[4]
		 },function(data){
			if(data==1){
			   alert('回复成功！');
			   location.reload();	
			}else{
			   alert('回复失败,请重新尝试');	
			}
		 });
	  });	  
   }); 
 });
 </script>
  <div class="module_public_main">
      <table>
        <form action="__URL__/batch_message_del" method="post">
        <tr style="background:#F0F0F0">
          <td align="center">编号</td>
          <td align="center">信息内容</td>
          <td align="center">信息发送时间</td>
          <td align="center">信息发送人</td>
          <td align="center">是否查看</td>
          <td align="center">是否回复</td>
          <td align="center">操作</td>
          <td align="center"><a href="#" id="all_check">全选/<a href="#" id="no_check">全不选</a></td>
        </tr>
        <?php if(is_array($m_info)): $k = 0; $__LIST__ = $m_info;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($k % 2 );++$k;?><tr>
          <td align="center"><?php echo ($k); ?></td>
          <td align="center"><a href="#" class="look_message" name="<?php echo ($v["m_content"]); ?>" title="<?php echo ($v["m_id"]); ?>">{查看短信息}</a></td>
          <td align="center"><?php echo (date("Y-m-d H:m",$v["m_addtime"])); ?></td>
          <td align="center"><?php echo ($v["m_sendname"]); ?></td>
          <?php if($v["m_looks_is"] == '1'): ?><td align="center"><font color=green>√</font></td>
          <?php else: ?>
          <td align="center"><font color=red>x</font></td><?php endif; ?>
          <?php if($v["m_reply_is"] == '1'): ?><td align="center"><font color=green>√</font></td>
          <?php else: ?>
          <td align="center"><font color=red>x</font></td><?php endif; ?>
          <td align="center">
            <a href="#" class="reply_message" title="<?php echo ($v["m_sendname"]); ?>|<?php echo ($v["m_sendUid"]); ?>|<?php echo ($v["m_rename"]); ?>|<?php echo ($v["m_reUid"]); ?>|<?php echo ($v["m_id"]); ?>">回复信息</a> | 
            <a href="#">删除纪录</a>
          </td>
          <td align="center"><input type="checkbox" class="check_is" value="<?php echo ($v["m_id"]); ?>" name="check_is[]"/></td>
        </tr><?php endforeach; endif; else: echo "" ;endif; ?>
        <tr>
          <td colspan="7" align="right"><?php echo ($fpage); ?></td>
          <td align="center"><input type="submit" value="删除选中项" class="_button"/></td>
        </tr>
        </form>
      </table>
  </div>
  </div>
</body>
</html>